home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / xiberty / configure.in
Text File  |  1994-08-25  |  3KB  |  97 lines

  1. # This file is a shell script fragment that supplies the information
  2. # necessary for a configure script to process the program in
  3. # this directory.  For more information, look at ../configure.
  4.  
  5. configdirs=
  6. srctrigger=../libiberty/getopt1.c
  7. srcname="cross -liberty library"
  8. Makefile_in=../libiberty/Makefile.in
  9.  
  10. case "$srcdir" in
  11.     ".") ;;
  12.     *) srcdir=${srcdir}/../libiberty ;;
  13. esac
  14.  
  15. # per-host:
  16. # per-target:
  17.  
  18. files="../libiberty/alloca-norm.h"
  19. links="alloca-conf.h"
  20.  
  21. xhost=${target}
  22. xsrcdir=../libiberty/
  23. . ${srcdir}/../libiberty/config.table
  24. if test -n "${frag}" ; then
  25.   target_makefile_frag=../libiberty/config/${frag}
  26. fi
  27.  
  28. case "$srcdir" in
  29.     ".")
  30.     # Make sure we also make links to all the source files
  31.     source_files=`echo ../libiberty/*.[ch] ../libiberty/functions.def`
  32.     files="${files} ${source_files}"
  33.     source_links=`echo "$source_files" | sed -e 's|../libiberty/||g'`
  34.     links="${links} ${source_links}"
  35.     ;;
  36.     *)
  37.     ;;
  38. esac
  39.  
  40. # post-target:
  41.  
  42. # if we are candian crossing the we need to pick up host copies of
  43. # the tools, otherwise we can look in the current tree
  44. # but we shouldn't build xiberty if we're not canadian crossing.
  45. if [ "${host}" != "${target}" ] ; then
  46.     echo "CC = ${target_alias}-gcc" > Makefile.tem
  47.     echo "AR = ${target_alias}-ar " >> Makefile.tem
  48.     echo "RANLIB = ${target_alias}-ranlib " >> Makefile.tem
  49. else
  50.     echo > Makefile.tem
  51. fi    
  52.  
  53. echo "INSTALL_DEST = tooldir" >> Makefile.tem
  54.  
  55. # If we are cross-compiling, check at compile time whether we are
  56. # using newlib.  If we are, we already know the files we need, since
  57. # the linker will fail when run on some of the newlib targets.
  58. if [ "${host}" != "${target}" ] ; then
  59.   cat > Makefile.tem2 <<'!EOF!'
  60. CONFIG_H = xconfig.h
  61. NEEDED_LIST = xneeded-list
  62.  
  63. xconfig.h: Makefile
  64.     if [ -f ../newlib/Makefile ]; then \
  65.       echo "#define NEED_sys_nerr 1" >xconfig.h; \
  66.       echo "#define NEED_sys_errlist 1" >>xconfig.h; \
  67.       echo "#define NEED_sys_siglist 1" >>xconfig.h; \
  68.       echo "#define NEED_psignal 1" >>xconfig.h; \
  69.     else \
  70.       $(MAKE) $(FLAGS_TO_PASS) lconfig.h; \
  71.       cp lconfig.h xconfig.h; \
  72.     fi
  73.  
  74. xneeded-list: Makefile
  75.     if [ -f ../newlib/Makefile ]; then \
  76.       echo insque.o random.o strdup.o alloca.o >xneeded-list; \
  77.     else \
  78.       $(MAKE) $(FLAGS_TO_PASS) lneeded-list; \
  79.       cp lneeded-list xneeded-list; \
  80.     fi
  81. !EOF!
  82. fi
  83. sed -e "/^####/  r Makefile.tem" -e "/^####/  r Makefile.tem2" ${Makefile} > Makefile.tem3
  84. mv Makefile.tem3 ${Makefile}
  85. rm -f Makefile.tem Makefile.tem2
  86.  
  87. if [ "${srcdir}" = "." ] ; then
  88.   echo "EXTRA_LINKS = ${source_links}" >>Makefile
  89. fi
  90. mv Makefile Makefile.tmp
  91. # Patch 'install' and 'Makefile' rules in Makefile
  92. # (The latter is only needed when "$srcdir" = ".".)
  93. sed <Makefile.tmp -e '/INSTALL_DEST =/s/libdir/tooldir/' \
  94.   -e '/Makefile/s|(srcdir)/Makefile.in|(srcdir)/../libiberty/Makefile.in|' \
  95.   >Makefile
  96. rm -f Makefile.tmp
  97.